/* Ejercicio 5.23
   ejer5_23.c */
#include <stdio.h>

/* Prototypes */
int time2Seconds( int hour, int minute, int second );

/* function main begins program execution */
int main( void )
{
    int h, m, s;

    printf( "Enter a time (h m s): " );
    scanf( "%d%d%d", &h, &m, &s );
    printf( "The time in seconds is: %d\n", time2Seconds( h, m, s ) );
	return 0; /* indicate that program ended successfully */
} /* end function main */

/* Gets the hour, minute and second, and return the time in seconds has passed since 0:00*/
int time2Seconds( int hour, int minute, int second )
{
    return hour * 3600 +  minute * 60 + second;
} /* end function time2Seconds */
